home *** CD-ROM | disk | FTP | other *** search
/ The Very Best of Atari Inside / The Very Best of Atari Inside 1.iso / mint / mnt99pc / makefile.pcc < prev    next >
Makefile  |  1993-01-26  |  6KB  |  213 lines

  1. #
  2. # Makefile for MiNT using the Pure CC
  3. #
  4.  
  5. # if you're cross-compiling, define NATIVECC
  6. # to the host's C compiler, NATIVECFLAGS to
  7. # the appropriate flags for it, and NATIVELIBS
  8. # to appropriate libraries
  9. # NATIVECC = cc -DNO_STDLIB
  10. # NATIVECFLAGS = -g
  11. # NATIVELIBS =
  12.  
  13. NATIVECC = gcc
  14. NATIVECFLAGS = -O
  15. NATIVELIBS = -liio
  16.  
  17. #
  18. # depending on your version of bison/yacc, you may
  19. # need to change these names, e.g. to
  20. # YACC = yacc
  21. # YTABC = y.tab.c
  22. # YTABH = y.tab.h
  23.  
  24. YACC = bison -d
  25. YTABC = asm_tab.c
  26. YTABH = asm_tab.h
  27.  
  28. # here are defs for the cross compiler
  29. # MiNT must be compiled with 16 bit integers
  30.  
  31. CC = cc -g
  32. AS = cc -Wa,-3 -Wa,-8 -Wa,-S -c
  33. MODEL =
  34. MODEL030 = -W0,-2
  35. LIBS = -lpctoslib.lib
  36.  
  37. # add -DMULTITOS for a MultiTOS kernel
  38. # add -DONLY030 for a version of MiNT that needs a 680x0, x>=3
  39.  
  40. DEFS = -DMULTITOS
  41. #DEFS030 = -DMULTITOS -DONLY030
  42. DEFS030 = -DONLY030
  43.  
  44. CFLAGS =  -D__STDC__ -W0,-P $(MODEL) $(DEFS)
  45. CFLAGS030 =  -D__STDC__ -W0,-P $(MODEL030) $(DEFS)
  46. ASFLAGS =
  47. ASFLAGS030 =
  48.  
  49. COBJS = bios.o xbios.o console.o dos.o dosdir.o dosfile.o dosmem.o dossig.o \
  50.     filesys.o main.o mem.o proc.o signal.o timeout.o tty.o util.o \
  51.     biosfs.o pipefs.o procfs.o tosfs.o debug.o rendez.o \
  52.     unifs.o shmfs.o fasttext.o welcome.o nalloc2.o memprot.o realloc.o
  53.  
  54. COBJS030 = bios.o0 xbios.o0 console.o0 dos.o0 dosdir.o0 dosfile.o0 dosmem.o0 dossig.o0 \
  55.     filesys.o0 main.o0 mem.o0 proc.o0 signal.o0 timeout.o0 tty.o0 util.o0 \
  56.     biosfs.o0 pipefs.o0 procfs.o0 tosfs.o0 debug.o0 rendez.o0 \
  57.     unifs.o0 shmfs.o0 fasttext.o0 welcome.o0 nalloc2.o0 memprot.o realloc.o0
  58.  
  59. CSRCS = bios.c xbios.c console.c dos.c dosdir.c dosfile.c dosmem.c dossig.c \
  60.     filesys.c main.c mem.c proc.c signal.c timeout.c tty.c util.c \
  61.     biosfs.c pipefs.c procfs.c tosfs.c debug.c rendez.c \
  62.     unifs.c shmfs.c fasttext.c welcome.c nalloc2.c memprot.c realloc.c
  63.  
  64. SOBJS = context.o intr.o syscall.o quickzer.o quickmov.o cpu.o
  65. SOBJS030 = context.o0 intr.o0 syscall.o0 quickzer.o0 quickmov.o0 cpu.o0
  66.  
  67. OBJS = $(COBJS) $(SOBJS)
  68. OBJS030 = $(COBJS030) $(SOBJS030)
  69.  
  70. all: mint.prg mint030.prg
  71.  
  72. mint.prg: $(OBJS)
  73.     $(CC) $(CFLAGS) -o mint.prg $(OBJS) $(LIBS)
  74.     prgflags 7 7 mint.prg
  75.     strip mint.prg
  76.  
  77. mint030.prg: $(OBJS030)
  78.     $(CC) $(CFLAGS030) -o mint030.prg $(OBJS030) $(LIBS)
  79.     prgflags 7 7 mint030.prg
  80.     strip mint030.prg
  81.  
  82. $(SOBJS): proc.h
  83. $(COBJS): mint.h proc.h file.h
  84.  
  85. $(SOBJS030): proc.h
  86. $(COBJS030): mint.h proc.h file.h
  87.  
  88. main.o: version.h
  89. welcome.o: version.h
  90. bios.o: inline.h
  91.  
  92. memprot.o: memprot.c mint.h proc.h file.h
  93.     $(CC) $(CFLAGS) $(MODEL030) -c memprot.c
  94.  
  95. main.o0: version.h
  96. welcome.o0: version.h
  97. bios.o0: inline.h
  98.  
  99. #
  100. # assembler source files are now handled in a radically different
  101. # fashion. We build a pre-processor program, asmtrans, that
  102. # takes the .spp files, merges them with an include file that
  103. # gives various offsets into structures of interest, and produces
  104. # the .s files as output. This has two major advantages:
  105. # (1) it lets us use the same source for both the Lattice and
  106. #     gcc assembler files (the translator will convert), and
  107. # (2) if we change the CONTEXT or PROC structures, we don't
  108. #     have to dig through the source code looking for
  109. #     magic numbers
  110.  
  111. # the asm translator program
  112. # Note that this must be compiled with the native CC of whatever
  113. # system you're using; see the definitions at the top of this
  114. # file.
  115.  
  116. ATRANSOBJ = asmtab.o trutil.o trans.o
  117. ATRANS = asmtrans.ttp
  118.  
  119. $(ATRANS): $(ATRANSOBJ)
  120.     $(NATIVECC) $(NATIVECFLAGS) -o $(ATRANS) $(ATRANSOBJ) \
  121.         $(NATIVELIBS)
  122.  
  123. asmtab.o: asmtab.c asmtrans.h
  124.     $(NATIVECC) $(NATIVECFLAGS) -o $@ -c asmtab.c
  125.  
  126. trutil.o: trutil.c asmtrans.h
  127.     $(NATIVECC) $(NATIVECFLAGS) -o $@ -c trutil.c
  128.  
  129. trans.o: trans.c asmtrans.h
  130.     $(NATIVECC) $(NATIVECFLAGS) -o $@ -c trans.c
  131.  
  132.  
  133. asmtab.c asmtab.h:    asm.y
  134.     $(YACC) asm.y
  135.     mv $(YTABC) asmtab.c
  136.     mv $(YTABH) asmtab.h
  137.  
  138. # the magic number include file is generated automagically
  139. # NOTE that of course, magic.i can only reliably be generated
  140. # on an Atari ST; if you're cross-compiling, you'll have
  141. # to edit magic.i by hand
  142. # for cross compilers; uncomment the following definitions
  143. # and comment out the other ones below
  144.  
  145. # for cross-compiling
  146.  
  147. # GENMAGICPRG=echo
  148. # magic.i: proc.h file.h genmagic.c
  149. #    echo "Warning: magic.i may be out of date"
  150.  
  151. #for native compiling
  152.  
  153. GENMAGICPRG=genmagic.ttp
  154.  
  155. $(GENMAGICPRG): genmagic.c proc.h file.h
  156.     $(CC) $(CFLAGS) -DGENMAGIC -o $(GENMAGICPRG) genmagic.c
  157.  
  158. magic.i: $(GENMAGICPRG)
  159.     $(GENMAGICPRG) $@
  160.  
  161. #
  162. # assembler source files
  163. #
  164. .SUFFIXES: .spp .o0
  165.  
  166. .spp.o:
  167.     $(ATRANS) $(DEFS) -purec -o $*.s $<
  168.     $(AS) $(ASFLAGS) -o $@ -c $*.s
  169.     $(RM) $*.s
  170. .spp.o0:
  171.     $(ATRANS) $(DEFS030) -purec -o $*.s $<
  172.     $(AS) $(ASFLAGS0) -o $@ -c $*.s
  173.     $(RM) $*.s
  174. .c.o0:
  175.     $(CC) $(CFLAGS030) -o $@ -c $<
  176.  
  177. context.o: context.spp magic.i $(ATRANS)
  178. intr.o: intr.spp magic.i $(ATRANS)
  179. syscall.o: syscall.spp magic.i $(ATRANS)
  180. quickzer.o: quickzer.spp $(ATRANS)
  181. quickmov.o: quickmov.spp $(ATRANS)
  182. cpu.o: cpu.spp $(ATRANS)
  183.  
  184. context.o0: context.spp magic.i $(ATRANS)
  185. intr.o0: intr.spp magic.i $(ATRANS)
  186. syscall.o0: syscall.spp magic.i $(ATRANS)
  187. quickzer.o0: quickzer.spp $(ATRANS)
  188. quickmov.o0: quickmov.spp $(ATRANS)
  189. cpu.o0: cpu.spp $(ATRANS)
  190.  
  191. #
  192. # mkptypes generates prototypes from C source code. If you don't have it,
  193. # you'll have to add/delete function prototypes by hand.
  194. # also: Sozobon users will have to edit proto.h by hand to change the
  195. #    #if defined(__STDC__) || defined(__cplusplus)
  196. # line into
  197. #    #if __STDC__
  198. #
  199. proto.h: $(CSRCS)
  200.     mkptypes $(CSRCS) >proto.h
  201.  
  202. #
  203. # macros for cleaning up
  204. #
  205. GENFILES= $(OBJS) $(OBJS030) $(ATRANSOBJ) $(ATRANS) $(GENMAGICPRG)
  206. EXTRAS= asmtab.c asmtab.h mint.prg
  207.  
  208. clean:
  209.     $(RM) $(GENFILES)
  210.  
  211. realclean:
  212.     $(RM) $(GENFILES) $(EXTRAS)
  213.